package com.dream.keigezhushou.Activity.pop;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.dream.keigezhushou.R;


/**
 *   分享弹窗
 */

public class SharePoupWindow extends DialogBase {

    private Context context;

    private ItemClickListener itemClickListener;
    private final ImageView ivWeiShare;
    private final ImageView ivFriendShare;
    private final ImageView ivSinaShare;
    private final ImageView ivTecentShare;


    /**
     * @param contentView
     * @param context
     * @param width
     * @param height      设置高度
     */
    public SharePoupWindow(View contentView, Context context, int width, int height) {
        super(contentView, context, width, height);
        this.context = context;
        ivWeiShare = (ImageView)  contentView.findViewById(R.id.iv_share_wei);
        ivFriendShare = (ImageView)  contentView.findViewById(R.id.iv_share_quan);
        ivSinaShare = (ImageView)  contentView.findViewById(R.id.iv_share_sina);
        ivTecentShare = (ImageView)  contentView.findViewById(R.id.iv_share_qq);

        ivWeiShare.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (itemClickListener!=null){
                    itemClickListener.onClick();
                }
                dismiss();

            }
        });

        ivFriendShare.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (itemClickListener!=null){
                    itemClickListener.onClick();
                }
                dismiss();
            }
        });

        ivSinaShare.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (itemClickListener!=null){
                    itemClickListener.onClick();
                }
                dismiss();
            }
        });

        ivTecentShare.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (itemClickListener!=null){
                    itemClickListener.onClick();
                }
                dismiss();
            }
        });


    }


    public void setItemListener(ItemClickListener itemClickListener) {

        this.itemClickListener = itemClickListener;
    }



    public interface ItemClickListener {

        public void onClick();
    }


}
